//
//  GiftCell.m
//  GiftTalk
//
//  Created by justaway on 15/8/16.
//  Copyright (c) 2015年 swiftyper. All rights reserved.
//

#import "GiftCell.h"
#import <UIImageView+WebCache.h>

@interface GiftCell ()

/** 礼物名称 */
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
/** 礼物图片 */
@property (weak, nonatomic) IBOutlet UIImageView *giftImageView;
/** 礼物价格 */
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
/** 礼物喜欢数 */
@property (weak, nonatomic) IBOutlet UIButton *likeCountButton;

@end

@implementation GiftCell

- (void)setGift:(Gift *)gift {
    _gift = gift;
    
    self.nameLabel.text = gift.name;
    self.priceLabel.text = [NSString stringWithFormat:@"￥%.2f", gift.price];
    [self.likeCountButton setTitle:[NSString stringWithFormat:@"%ld", gift.favorites_count] forState:UIControlStateNormal];
    
    NSURL *coverImageUrl = [NSURL URLWithString:gift.cover_image_url];
    [self.giftImageView sd_setImageWithURL:coverImageUrl placeholderImage:[UIImage imageNamed:@"PlaceHolderImage_small"]];
}



@end
